
#include <ClanLib/core.h>
#include <ClanLib/network.h>
#include "Network/Server.h"

int main(int argc, char **argv)
{
	CL_SetupCore setup_core;
	CL_SetupNetwork setup_network;

	try
	{
		CL_ConsoleLogger logger;
		Network::Server server;

		if(argc == 1)
		{
			// Default to console mode for Service
			char *debug_argv[2] = { argv[0], "-debug" };
			return server.main(2, debug_argv);
		}
		else
		{
			return server.main(argc, argv);
		}
	}
	catch(CL_Exception &e)
	{
		CL_Console::write_line("Unhandled Exception: %1", e.get_message_and_stack_trace());
		return -1;
	}

	return 0;
}
